package com.bwie.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program: day0617mounth
 * @ClassName R
 * @description:
 * @author: 段阳
 * @create: 2024-06-17 09:28
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {//统一数据返回格式

    private String message;
    private Boolean flag;
    private int code;
    private Object data;

    /**
    * //TODO 统一数据返回格式
    * @author 段阳
    * @date 2024/6/17 9:32
     * @param message
     * @param data
     * @return com.bwie.util.R
    */
    public static  R success(String message,Object data){
        return new R(message,true,200,data);
    }
    /**
     * //TODO 统一数据返回格式
     * @author 段阳
     * @date 2024/6/17 9:32
     * @param message
     * @return com.bwie.util.R
     */
    public static  R success(String message){
        return new R(message,true,200,null);
    }
    /**
     * //TODO 统一数据返回格式
     * @author 段阳
     * @date 2024/6/17 9:32
     * @param message
     * @param code
     * @return com.bwie.util.R
     */
    public static  R error(int code,String message){
        return new R(message,false,code,null);
    }

}